//阅读程序 指出程序输出的值
#include <iostream>
using namespace std;

class Base{
    public:
    void print(){
        cout<<"This is Base\n";
    }
};
class Sub:public Base{
    public:
    void print(){
        cout<<"This is Sub\n";
    }
};

int main(int argc, char const *argv[])
{
    Base* b1 = new Base();
    Base* b2 = new Sub();
    Sub* b3 = new Sub();
    b1->print();
    b2->print();    //B类中没有设为虚函数 不会被重写
    b3->print();
    return 0;
}
